
#region Imported Namespaces
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

using CenterDialog = PHSRAG.Utility.CenterDialog;
#endregion

namespace SecurityTest
{
	public class UserInfo : Form
	{
		#region Instance Variables
		private Button		cancel;
		private Container	components = null;
		private Panel		expandPanel;
		private CheckBox	getAllInfo;
		private TextBox		infoToGet;
		private Label		infoLabel;
		private Button		ok;
		#endregion

		#region Public Properties
		public bool		GetAll		{ get { return getAllInfo.Checked; } }
		public string	InfoToGet	{ get { return infoToGet.Text.Trim(); } }
		#endregion

		#region Constructor
		public UserInfo()
		{
			InitializeComponent();
		}
		#endregion

		#region Overrides
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
				components.Dispose();
			base.Dispose(disposing);
		}
		#endregion

		#region Event Handlers
		private void OnOK(object sender, System.EventArgs e)
		{
			if (!getAllInfo.Checked && (infoToGet.Text.Trim().Length == 0))
			{
				DialogResult = DialogResult.None;
				CenterDialog dialog = new CenterDialog(this);
				dialog.BeginCentering();
				MessageBox.Show(this, "You must specify at leat one attribute for retrieval", "Missing Data",
					MessageBoxButtons.OK, MessageBoxIcon.Error);
				dialog.EndCentering();
			}
			else
				DialogResult = DialogResult.OK;
		}

		private void OnCheckChanged(object sender, System.EventArgs e)
		{
			if (getAllInfo.Checked)
				Height -= expandPanel.Height;
			else
				Height += expandPanel.Height;
		}

		private void OnLoad(object sender, System.EventArgs e)
		{
			Height -= expandPanel.Height;
		}
		#endregion

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.getAllInfo = new System.Windows.Forms.CheckBox();
			this.cancel = new System.Windows.Forms.Button();
			this.ok = new System.Windows.Forms.Button();
			this.expandPanel = new System.Windows.Forms.Panel();
			this.infoToGet = new System.Windows.Forms.TextBox();
			this.infoLabel = new System.Windows.Forms.Label();
			this.expandPanel.SuspendLayout();
			this.SuspendLayout();
			// 
			// getAllInfo
			// 
			this.getAllInfo.Checked = true;
			this.getAllInfo.CheckState = System.Windows.Forms.CheckState.Checked;
			this.getAllInfo.Location = new System.Drawing.Point(7, 8);
			this.getAllInfo.Name = "getAllInfo";
			this.getAllInfo.Size = new System.Drawing.Size(119, 24);
			this.getAllInfo.TabIndex = 1;
			this.getAllInfo.Text = "Get All Information";
			this.getAllInfo.CheckedChanged += new System.EventHandler(this.OnCheckChanged);
			// 
			// cancel
			// 
			this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.cancel.Location = new System.Drawing.Point(225, 8);
			this.cancel.Name = "cancel";
			this.cancel.Size = new System.Drawing.Size(61, 23);
			this.cancel.TabIndex = 6;
			this.cancel.Text = "Cancel";
			// 
			// ok
			// 
			this.ok.Location = new System.Drawing.Point(154, 8);
			this.ok.Name = "ok";
			this.ok.Size = new System.Drawing.Size(61, 23);
			this.ok.TabIndex = 5;
			this.ok.Text = "OK";
			this.ok.Click += new System.EventHandler(this.OnOK);
			// 
			// expandPanel
			// 
			this.expandPanel.Controls.Add(this.infoToGet);
			this.expandPanel.Controls.Add(this.infoLabel);
			this.expandPanel.Location = new System.Drawing.Point(2, 37);
			this.expandPanel.Name = "expandPanel";
			this.expandPanel.Size = new System.Drawing.Size(289, 236);
			this.expandPanel.TabIndex = 7;
			// 
			// infoToGet
			// 
			this.infoToGet.Location = new System.Drawing.Point(7, 64);
			this.infoToGet.Multiline = true;
			this.infoToGet.Name = "infoToGet";
			this.infoToGet.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
			this.infoToGet.Size = new System.Drawing.Size(276, 165);
			this.infoToGet.TabIndex = 4;
			this.infoToGet.Text = "sn,givenName";
			// 
			// infoLabel
			// 
			this.infoLabel.Location = new System.Drawing.Point(5, 8);
			this.infoLabel.Name = "infoLabel";
			this.infoLabel.Size = new System.Drawing.Size(277, 41);
			this.infoLabel.TabIndex = 3;
			this.infoLabel.Text = "Specify a comma-separated list of attributes to be retrieved for the user (for ex" +
				"ample: sn, givenName, etc.) :";
			// 
			// UserInfo
			// 
			this.AcceptButton = this.ok;
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.CancelButton = this.cancel;
			this.ClientSize = new System.Drawing.Size(292, 273);
			this.Controls.Add(this.expandPanel);
			this.Controls.Add(this.cancel);
			this.Controls.Add(this.ok);
			this.Controls.Add(this.getAllInfo);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.Name = "UserInfo";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
			this.Text = "Specifiy User Info for retrieval";
			this.Load += new System.EventHandler(this.OnLoad);
			this.expandPanel.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion
	}
}

// --- EOF ---
